﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Customer_Profile.eCardReport.DBDao;
using KVB.Common;
using System.Text;
using Customer_Profile.eCard.DBDao;
using DevExpress.Data;
using DevExpress.Web.ASPxGridView;

namespace Customer_Profile.eCardReport
{
    public partial class CpartySummary_Report : System.Web.UI.Page
    {
        DataSet dsResult = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            BindDataView();
            ASPxGridView1.GroupSummarySortInfo.Clear();
            ColumnSortOrder sortOrder = ColumnSortOrder.Descending;
            ASPxGridView1.GroupSummarySortInfo.AddRange(new ASPxGroupSummarySortInfo("cparty_name", ASPxGridView1.GroupSummary["real_count"], sortOrder));
        }

        private void BindDataView()
        {
            string strName = txtCparty.Text.Trim();
            try
            {
                dsResult = ReportDao.getCpartyData(strName);
                if (dsResult != null && dsResult.Tables.Count > 0)
                {
                    ASPxGridView1.DataSource = dsResult.Tables[0];
                    ASPxGridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                Log.WriteDefaultLog("Maturity_BindDataView", ex.ToString());
            }
        }

        protected void btnExport_Click(object sender, EventArgs e)
        {
            gridExport.WriteXlsToResponse("客户购买合计");
        }
    }
}